﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Balder.Core.Objects.Geometries;
using Balder.Core.Math;


namespace Studio
{
    public partial class SceneControl : UserControl
    {
        //private SceneDocument sceneDocuments;
        public SceneControl()
        {
            InitializeComponent();
            //sceneDocuments = new SceneDocument();
            //sceneDocuments = (SceneDocument)Project.ProjectDocuments[0];
            this.MouseLeftButtonDown += new MouseButtonEventHandler(SceneControl_MouseLeftButtonDown);
        }

        private Mesh _audi;
        private Coordinate pos = new Coordinate(0,0,0);
        void SceneControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Point p = e.GetPosition(SceneClass);
            //for (int i = 0; i < sceneDocuments.DocumentsList.Count; i++)
            //{
            //    _audi = SceneClass.ContentManager.Load<Mesh>(sceneDocuments.DocumentsList[i].FilePath);
            //    _audi.Position = pos;
            //    SceneClass.Scene.AddNode(_audi);
            //    pos.X += .3;
            //    pos.Y += .3;
            //    pos.Z += .3;
            //}
            _audi = SceneClass.ContentManager.Load<Mesh>("audi.ASE");
            _audi.Position = pos;
            SceneClass.Scene.AddNode(_audi);
            pos.X += .3;
            pos.X += .3;
            pos.X += .3;
            MessageBox.Show(p.X.ToString() + "," + p.Y.ToString() + " " + SceneClass.Scene.RenderableNodes.Count.ToString());
        }
    }
}
